package com.gome.gop.common;

import java.util.Arrays;
import java.util.List;

public class CloudRestData<T> {
    
    private static List<String> SUCCESS_CODES = Arrays.asList("0", "0000", "200");
    
    private static List<String> SUCCESS_LIST = Arrays.asList("true");
    
    /**
     * 状态码
     */
    private String code;
    
    /**
     * 数据结果
     */
    private T data;
    
    /**
     * 操作是否成功
     */
    private String success;
    
    /**
     * 消息
     */
    private String msg;
    
    /* 异常信息 */
    private String exceptionMsg;
    
    public boolean isSuccess() {
        if (SUCCESS_LIST.contains(success)) {
            return true;
        }
        else if (SUCCESS_CODES.contains(code)) {
            return true;
        }
        return false;
    }
    
    /**
     * @return the code
     */
    
    public String getCode() {
        return code;
    }
    
    /**
     * @param code the code to set
     */
    
    public void setCode(String code) {
        this.code = code;
    }
    
    /**
     * @return the data
     */
    
    public T getData() {
        return data;
    }
    
    /**
     * @param data the data to set
     */
    
    public void setData(T data) {
        this.data = data;
    }
    
    /**
     * @return the success
     */
    
    public String getSuccess() {
        return success;
    }
    
    /**
     * @param success the success to set
     */
    
    public void setSuccess(String success) {
        this.success = success;
    }
    
    /**
     * @return the msg
     */
    
    public String getMsg() {
        return msg;
    }
    
    /**
     * @param msg the msg to set
     */
    
    public void setMsg(String msg) {
        this.msg = msg;
    }
    
    /**
     * @return the exceptionMsg
     */
    
    public String getExceptionMsg() {
        return exceptionMsg;
    }
    
    /**
     * @param exceptionMsg the exceptionMsg to set
     */
    
    public void setExceptionMsg(String exceptionMsg) {
        this.exceptionMsg = exceptionMsg;
    }
}
